package com.bluebridgecup.BasicAlgorithms.BasicAlgorithmComprehensiveProblem;

import java.util.Scanner;

// 前缀和与前缀异或和
public class PrefixSumAndPrefixXorSum {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int q = in.nextInt();
        long[] a = new long[n + 1];
        long[] s1 = new long[n + 1];
        long[] s2 = new long[n + 1];
        for (int i = 1; i <= n; i++) {
            a[i] = in.nextLong();
            s1[i] = s1[i - 1] + a[i];
            s2[i] = s2[i - 1] ^ a[i];
        }
        while (q-- > 0) {
            int x = in.nextInt();
            int y = in.nextInt();
            long ans = s1[y] - s1[x - 1];
            long yihuo = s2[y] ^ s2[x - 1];
            String c = ans == yihuo ? "YES" : "NO";
            System.out.println(c);
        }
    }
}
